<?php
header("Content-Type: text/javascript");
include 'config.php';
function xmltoarr($x)
{
	$x = (array) $x;
	foreach(array_keys($x) as $k)
	{
		if(is_string($x[$k]))
		{
			$x[$k] = str_replace(array("\t","\n"),"",$x[$k]);
			if($x[$k] == "") unset($x[$k]);
			continue;
		}
		if(!is_array($x[$k])) $x[$k] = xmltoarr($x[$k]);
	}
	return $x;
}
function expand($a,$name = '')
{
    foreach($a as $k => $v)
    {
        if(!is_array($v)) echo "\t\t'".$name.$k."': '".$v."',\n";
        else
        {
            expand($v,$name.$k."/");
        }
    }
}
$xml = xmltoarr(simplexml_load_file('lang/'.$config['lang']['default'].'/lang.xml'));
?>
var i18n = {};
i18n = {
    'get': function (item, params) {
        return this.data[item].format(params);
    },
    'data': {
<?php
expand($xml);
?>
    }
};